jQuery(document).ready(function() { jQuery.ajax({ url: 'https://freegeoip.net/json/', dataType: 'jsonp', cache: true, jsonp: 'callback', success: function(data) { if (data.country_code == 'BR') { jQuery('#result').append(data.country_code); } else { jQuery('#result').append('PT'); } //jQuery('#result').append('

Pais: ' + data.country_code + '
IP: ' + data.ip + '
LatLng: ' + data.latitude + ', ' + data.longitude); var pais = data.country_code + '_pplware-comparador-v21.gif'; //jQuery('#a_pais').off('click'); jQuery('#a_pais').attr('onclick', ''); jQuery('#a_pais').attr('onclick', "recordOutboundLink(this, 'Outbound Links', 'www.comparador-precos.com.br')"); jQuery('#a_pais').attr('href', 'www.comparador-precos.com.br'); jQuery('#pais').attr('src',pais); }, error: function() { //jQuery('#result').append('geolocation not supported'); jQuery('#pais').attr('src', 'PTT'); } }); });